#ifndef yinshu_gwWINDOW_H
#define yinshu_gwWINDOW_H

#include <QMainWindow>
#include <queue>

QT_BEGIN_NAMESPACE
namespace Ui { class yinshu_gwWindow; }
QT_END_NAMESPACE

class yinshu_gwWindow : public QMainWindow
{
    Q_OBJECT

public:
    yinshu_gwWindow(QWidget *parent = nullptr);
    ~yinshu_gwWindow();
    std::string _memberId;
private slots:
    void on_JoinBtn_clicked();

    void on_leaveButton_clicked();

    void on_startRecord_clicked();
    void on_stopRecord_clicked();    
    void on_meetRecord_clicked();

private:
    Ui::yinshu_gwWindow *ui;
    //创建亮眼SDK
    void * _shine_handle = NULL;

    std::string _roomToken;
    std::string _mediaServerIP;
    int _mediaServerPort;

    //音频列表队列
    std::queue<std::string> _pcmQueue;

    bool _recording=false;
    FILE* _fpRecord=NULL;
    //定时存储任务
public:
    void* handle(){
        return _shine_handle;
    }
    void SetStatus(std::string status);
    //音频入队列
    void Enqueue(uint8_t* pcm,int len);
private:
    int _record_timer_id;
    void delayMs(int ms);
    void timerEvent(QTimerEvent *event) override;
};
#endif // yinshu_gwWINDOW_H
